import { Logger } from "../log/logger";
import Inject from "./Inject";
import Singleton from "./Singleton";

export class Context extends Singleton {

    public static get I() { return this.Instance() }

    /**
     * 作用于单例，在注册是创建 并且永不销毁
     */
    private asConst: Inject;

    /**
     * 作用与实列，在使用时创建，可以动态销毁
     */
    private asModel: Inject;

    constructor() {
        super();
        this.asConst = new Inject();
    }

    public LogCache() {
        Logger.logConfig(this.asConst['_objs']);
    }

    /**实列并缓存脚本，只会实列一次 */
    get<T>(c: new () => T): T {
        return this.asConst.get(c);
    }


    recycle<T>(c: T) {

    }

}
// export const cxt = context.I;
